/*
 * (#)FASUserController.java 1.0  2013年7月15日 GMT+08:00
 */
package com.newtouch.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.newtouch.common.Page;
import com.newtouch.model.FASRole;
import com.newtouch.model.FASUser;
import com.newtouch.service.FASRoleService;
import com.newtouch.service.FASUserService;

/**
 * @author 凌蒙
 * @version V1.0, 2013年7月15日 GMT+08:00
 * @since JDK1.6
 */
@Controller
@RequestMapping("/fasrole")
public class FASRoleController {
	private static final Log logger = LogFactory.getLog(FASRoleController.class);
	@Autowired
	FASRoleService fASRoleService;
	@RequestMapping(value = "list", produces = "text/html")
    public String list(Model uiModel) {
		Page page = new Page();
        uiModel.addAttribute("fasRoleList", fASRoleService.findFASRoles(page));
        return "fasroles/list";
    }
	@RequestMapping(value = "create", produces = "text/html")
    public String create(Model uiModel) {
		 uiModel.addAttribute("fasrole", new FASRole());
        return "fasroles/create";
    }
	@RequestMapping(value = "createMethod", method = RequestMethod.POST, produces = "text/html")
    public String createMethod(FASRole fasrole,  Model uiModel,
			 HttpServletRequest httpServletRequest) {
		uiModel.asMap().clear();
		logger.debug(fasrole.getRoleName());
		fASRoleService.addFASRole(fasrole);
		return "redirect:/fasrole/list";
    }
}
